package eightDataType;

import java.util.HashSet;

/**
 * @Author: Jie
 * @Date: 2019/4/19 19:17
 * @Function :
 */
public class LongDemo {
    public static void main(String[] args) {
        long currentTimeMillis = System.currentTimeMillis();
        long num =  1000*60*60*24*31*2L;
        long num2 =   1000L*60L*60L*24L*31L*2L;
        double dNum =  1000*60*60*24*31*2L;
        System.out.println(currentTimeMillis);
        System.out.println(num);
        System.out.println(num2);
        System.out.println(String.valueOf(num));
        System.out.println((double)(num));
        System.out.println(currentTimeMillis -num);
        System.out.println((double) currentTimeMillis -dNum);



        double v = 1L* 1.2;

        System.out.println("v:"+v);
        long abc=1L,bbb=2L;
        System.out.println("v:"+(v>abc)+(v>bbb));
        System.out.println(5D /3D);
        System.out.println(5L /3L);
        System.out.println(5D * 100/3D);
        System.out.println(5L * 100/3L);
        System.out.println(Math.round(5L * 100/3L));
        System.out.println("LongMax=="+Long.MAX_VALUE );
        Long max = Long.MAX_VALUE;
        int places = getPlaces(max);
        System.out.println("Long 的位数"+ places);
        System.out.println("sCur 的位数"+  getPlaces(System.currentTimeMillis()));

        Long a = 12345678L;
        long b = 12345678;
        System.out.println((a==b));
        HashSet<Long> set = new HashSet<>();
        set.add(a);
        System.out.println("set contains long == "+set.contains(b));
    }

    private static int getPlaces(Long max) {
        int places= 0 ;
        while (max >0 ){
            places++;
            max = max/10;
        }
        return places;
    }
}
